package net.zjitc.api;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Random;

/**
 * @Author admin
 * @Date 2019/3/27 9:37
 */
public class StringBuffer {
    public StringBuffer(String hskjhfkj) {

    }

    public static void main(String[] args) {
        System.out.println("---添加---");
        StringBuffer sd1=new StringBuffer("hskjhfkj");
        sd1.append("gfhghjgh");
        System.out.println("append添加结果："+sd1);
        sd1.insert(2,"123");
        System.out.println("insert指定位置添加结果："+sd1);
        System.out.println("---删除---");
        sd1.delete(1,8);
        System.out.println("delete删除指定位置结果："+sd1);
        sd1.deleteCharAT(1);
        System.out.println("deleteCharAT删除指定位置结果："+sd1);
        sd1.delete(0,sd1.length());
        System.out.println("清空缓冲区结果;"+sd1);

        StringBuffer sd2=new StringBuffer("irguigui");
        System.out.println("---修改---");

        System.out.println("向下取整5.6:"+Math.floor(5.6));
        System.out.println("四舍五入5.6："+Math.round(5.6));
        System.out.println("2的3次方："+Math.pow(2,3));
        System.out.println("2和6的最大值："+Math.max(2,6));
        System.out.println("0到1的最大值："+Math.random());

        int random=(int) (Math.random()*100+1);
        System.out.println("使用Math的random方法生成1到100之间的随机数："+random);
        Random r=new Random();
        System.out.println("使用Random类生成int型随机数："+r.nextInt());
        System.out.println("使用Random类生成1到100的随机数："+(r.nextInt(100)+1));
        System.out.println("使用Random（）构造方法生成5个随机数（执行2次值不同）：");
        for (int i = 0; i <5 ; i++) {
            System.out.println(r.nextInt(100));

            Random r2=new Random(5);
            System.out.println("使用Random（long）构造方法生成5个随机数（执行2次值一样）");
            for (int j = 0; j <5 ; j++) {
                System.out.println(r2.nextInt(100));
            }
        }

    }

    private int length() {
        return 0;
    }

    private void deleteCharAT(int i) {

    }

    private void delete(int i, int i1) {

    }

    private void insert(int i, String s) {

    }

    private void append(String gfhghjgh) {

    }
}
